<?php
	mysql_connect('localhost', 'root', '');
	
	mysql_select_db('poll');
	
	$query = 'SELECT * FROM votes ORDER BY variant';
	
	$res = mysql_query($query);
	
	$votes = array();
	while($row = mysql_fetch_array($res)) {
		//print_r($row);
		$votes[] = $row;
	}
	
	mysql_close();
?>
<html>
        <meta http-equiv="Content-Type" content="text/html; charset=cp1251" />
    <head>
        <title>Опрос</title>
    </head>
    <body>
        <b>Какой курс самый сложный:</b>
        <form action="vote.php" method="GET">
            <? foreach($votes as $i => $vote) { ?> 
                <input type="radio" name="cource" value="<?=$vote['num']?>" />
                       <?=$vote['variant']?> - <?=$vote['vote']?> голосов<br />
            <? } ?>
            <input type="submit" value="Голосовать" />
        </form>
    </body>
</html>
	